﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Activities.DAL.DAL;
using Activities.DAL.Model;

namespace Activities.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ActivitiesService" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select ActivitiesService.svc or ActivitiesService.svc.cs at the Solution Explorer and start debugging.
    public class ActivitiesService : IActivitiesService
    {
        private string conn = ConfigurationManager.ConnectionStrings["MVC3"].ToString();
        private ActivitiesDal result;
        public List<ActivitiesModel> GetActivities()
        {
            result = new ActivitiesDal(conn);

            return result.GetItem();
        }

        public bool AddData(ActivitiesModel item)
        {
            result = new ActivitiesDal(conn);
            return result.Insert(item);
        }

        public bool DeleteData(ActivitiesModel itemId)
        {
            result = new ActivitiesDal(conn);
            return result.Delete(itemId);
        }
    }
}
